<?php
namespace modules\gallery;
use \phiction\exceptions\bad_request;
use \phiction\array_utils as arr;

class api
{
    static function echo($q, &$args)
    {
        $id = arr::get_or_bad_request($args, 'id');
        $hello_world = arr::get_or_bad_request($args, 'hello-world');
        if ($id === 'root' && $hello_world === 'hi') return true;
        throw new bad_request("echo by throwing error:\nid = $id, hello-world = $hello_world");
    }

    static function ok($q, &$args)
    {
        $id = arr::get_or_bad_request($args, 'id');
        return $id;
    }
}

